<html>
<head><meta charset="utf-8"><title>Span of external items · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Span.20of.20external.20items.html">Span of external items</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="220133426"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Span%20of%20external%20items/near/220133426" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Federico Poli <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Span.20of.20external.20items.html#220133426">(Dec 16 2020 at 15:57)</a>:</h4>
<p>Is there a way to get the span of external <code>DefId</code>s using the compiler API? Or is it impossible because such information is only available in debug builds?</p>



<a name="220133946"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Span%20of%20external%20items/near/220133946" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Span.20of.20external.20items.html#220133946">(Dec 16 2020 at 16:01)</a>:</h4>
<p>You can use <code>tcx.def_span(def_id)</code>.</p>



<a name="220134988"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Span%20of%20external%20items/near/220134988" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Federico Poli <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Span.20of.20external.20items.html#220134988">(Dec 16 2020 at 16:09)</a>:</h4>
<p><span class="user-mention silent" data-user-id="133247">bjorn3</span> <a href="#narrow/stream/182449-t-compiler.2Fhelp/topic/Span.20of.20external.20items/near/220133946">said</a>:</p>
<blockquote>
<p>You can use <code>tcx.def_span(def_id)</code>.</p>
</blockquote>
<p>Much easier than I thought :D Thanks!</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>